//添加中心
function cd_addcenter(t){
	var s='添加中心';
	if(t>0){
		s='编辑中心';
	}
	$.post("index.php?ac=addajax&ts=addcenter",
			{
				id:t
			},
				function(msg){
				$(".ctop font").text(s);
				$(".cw").html(msg);
			});
	$("#cwin .cmain").css({"left":"15%","width":"70%","top":"10%","height":"80%"});
	var h=parseInt(document.documentElement.clientHeight*0.8);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}

//添加时段
function cd_addtime(t){
	var s='添加时段';
	if(t>0){
		s='编辑时段';
	}
	$.post("index.php?ac=addajax&ts=addtimeset",
			{
				id:t
			},
				function(msg){
				$(".ctop font").text(s);
				$(".cw").html(msg);
			});
	$("#cwin .cmain").css({"left":"30%","width":"40%","top":"30%","height":"40%"});
//	$(".cw").css("height","86%");
	var h=parseInt(document.documentElement.clientHeight*0.4);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}

function cd_editface(t){
	var s='勾选头像';
	$.post("index.php?ac=addajax&ts=editface",
			{
				id:t
			},
				function(msg){
				$(".ctop font").text(s);
				$(".cw").html(msg);
			});
	$("#cwin").show();
}
function  chkface(u){
	var s=$(u).attr("src");
	$(".faceimg").attr("src",s);
	$("#path").val(s);
	$("#cwin").hide();
}

//添加教室
function cd_addroom(t){
	var s='添加教室';
	if(t>0){
		s='编辑教室';
	}
	$.post("index.php?ac=addajax&ts=addroom",
			{
				id:t
			},
				function(msg){
				$(".ctop font").text(s);
				$(".cw").html(msg);
			});
	$("#cwin .cmain").css({"left":"20%","width":"60%","top":"20%","height":"60%"});
//	$(".cw").css("height","90%");
	var h=parseInt(document.documentElement.clientHeight*0.6);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}
//添加跟踪天数
function cd_addgz(t){
	var s='添加跟踪设置';
	if(t>0){
		s='编辑跟踪设置';
	}
	$.post("index.php?ac=addajax&ts=addgzset",
			{
				id:t
			},
				function(msg){
				$(".ctop font").text(s);
				$(".cw").html(msg);
			});
	$("#cwin .cmain").css({"left":"30%","width":"40%","top":"30%","height":"40%"});
//	$(".cw").css("height","86%");
	var h=parseInt(document.documentElement.clientHeight*0.4);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}
//通用添加子窗口
function cd_addcw(t,u,s,w){
	$.post("index.php?ac=addajax&ts="+u,
			{
				id:t
			},
				function(msg){
				$(".ctop font").text(s);
				$(".cw").html(msg);
			});
	if(w==1){
		$("#cwin .cmain").css({"left":"20%","width":"60%","top":"20%","height":"60%"});
		var h=parseInt(document.documentElement.clientHeight*0.6);
		$(".cw").css("height",h-48);
	}else if(w==2){
		$("#cwin .cmain").css({"left":"30%","width":"40%","top":"30%","height":"40%"});
		var h=parseInt(document.documentElement.clientHeight*0.4);
		$(".cw").css("height",h-48);
	}else{
		$("#cwin .cmain").css({"left":"15%","width":"70%","top":"10%","height":"80%"});
		var h=parseInt(document.documentElement.clientHeight*0.8);
		$(".cw").css("height",h-48);
	}
	$("#cwin").show();
}
function cd_addkcxsdm(id,tm){
	$.post("index.php?ac=addajax&ts=addkcxsdm",
			{
				id:id,
				tm:tm
			},
				function(msg){
				var s=msg.split('|');
				$(".ctop font").text(s[0]);
				$(".cw").html(s[1]);
			});
	$("#cwin .cmain").css({"left":"15%","width":"70%","top":"10%","height":"80%"});
	var h=parseInt(document.documentElement.clientHeight*0.8);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}
function cd_addkcrd(id,tm,cid){
	$.post("index.php?ac=addajax&ts=addkcrd",
			{
				id:id,
				tm:tm,
				cid:cid
			},
				function(msg){
				var s=msg.split('|');
				$(".ctop font").text(s[0]);
				$(".cw").html(s[1]);
			});
	$("#cwin .cmain").css({"left":"20%","width":"60%","top":"20%","height":"60%"});
	var h=parseInt(document.documentElement.clientHeight*0.6);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}
function cd_ckucun(t){
	$.post("index.php?ac=addajax&ts=ckucun",
			{
				id:t
			},
				function(msg){
				$(".ctop font").text('货品出库');
				$(".cw").html(msg);
			});
	$("#cwin .cmain").css({"left":"20%","width":"60%","top":"20%","height":"60%"});
//	$(".cw").css("height","90%");
	var h=parseInt(document.documentElement.clientHeight*0.6);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}
function cd_vkucun(t){
	$.post("index.php?ac=addajax&ts=vkucun",
			{
				id:t
			},
				function(msg){
				$(".ctop font").text('领取记录');
				$(".cw").html(msg);
			});
	$("#cwin .cmain").css({"left":"15%","width":"70%","top":"10%","height":"80%"});
//	$(".cw").css("height","93%");
	var h=parseInt(document.documentElement.clientHeight*0.8);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}
function cd_cjiaocai(t){
	$.post("index.php?ac=addajax&ts=cjiaocai",
			{
				id:t
			},
				function(msg){
				$(".ctop font").text('领取教材');
				$(".cw").html(msg);
			});
	$("#cwin .cmain").css({"left":"20%","width":"60%","top":"20%","height":"60%"});
//	$(".cw").css("height","90%");
	var h=parseInt(document.documentElement.clientHeight*0.6);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}
function cd_vjiaocai(t){
	$.post("index.php?ac=addajax&ts=vjiaocai",
			{
				id:t
			},
				function(msg){
				$(".ctop font").text('领取记录');
				$(".cw").html(msg);
			});
	$("#cwin .cmain").css({"left":"15%","width":"70%","top":"10%","height":"80%"});
//	$(".cw").css("height","93%");
	var h=parseInt(document.documentElement.clientHeight*0.8);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}
//市场渠道
function cd_addmkc(t){
	var s='添加渠道';
	if(t>0){
		s='编辑渠道';
	}
	$.post("index.php?ac=addajax&ts=addmkc",
			{
				id:t
			},
				function(msg){
				$(".ctop font").text(s);
				$(".cw").html(msg);
			});
	$("#cwin .cmain").css({"left":"20%","width":"60%","top":"20%","height":"60%"});
//	$(".cw").css("height","90%");
	var h=parseInt(document.documentElement.clientHeight*0.6);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}
function cd_chaocai(t){
	$.post("index.php?ac=addajax&ts=chaocai",
			{
				id:t
			},
				function(msg){
				$(".ctop font").text('领取耗材');
				$(".cw").html(msg);
			});
	$("#cwin .cmain").css({"left":"20%","width":"60%","top":"20%","height":"60%"});
//	$(".cw").css("height","90%");
	var h=parseInt(document.documentElement.clientHeight*0.6);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}
function cd_vhaocai(t){
	$.post("index.php?ac=addajax&ts=vhaocai",
			{
				id:t
			},
				function(msg){
				$(".ctop font").text('领取记录');
				$(".cw").html(msg);
			});
	$("#cwin .cmain").css({"left":"15%","width":"70%","top":"10%","height":"80%"});
//	$(".cw").css("height","93%");
	var h=parseInt(document.documentElement.clientHeight*0.8);
	$(".cw").css("height",h-48);
	$("#cwin").show();
}
function cd_mprice(u,t){
	var x=$(u).offset().left;
	var y=$(u).offset().top;
	$.post("index.php?ac=addajax&ts=addmprice",
			{
				id:t
			},
			function(msg){
				if(msg!=''){
					$(".mt_bb").css("width","500px");
					$(".mt_bb").css("height","280px");
					$(".mt_bb").show().html(msg);
					$(".mt_bb").css("left",x-460);
					$(".mt_bb").css("top",y-280);
				}
			});
}

